import { get } from './axios.js'
import { upCardInfo } from './typeInterface'
import { getCookies } from '@/utils/cookies'

export function getImgColor(img:string){
    img = img.slice(19)
    return get( img +'@.avg_color','','/imgColor').then(res => res.RGB)
}
export function getAvaInfo(mid:number):upCardInfo{
    return  get('/x/web-interface/card?csrf='+ getCookies('bili_jct') +'&mid='+ mid +'&photo=1','','/bili')
            .then(res => res.data)
            .catch(res => { alert('获取up主信息失败') })
}